﻿using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Windows;
using Update;
using System.Diagnostics;

namespace DosyaUpload
{
    /// <summary>
    /// Interaction logic for App.xaml
    /// </summary>
    public partial class App : Application
    {
        protected override void OnStartup(StartupEventArgs e)
        {                        
            argüman(e.Args);            
         //   StaticClass.initializeGlobalVariables();
            base.OnStartup(e);            
        }
        private void argüman(string[] y)
        {
            string processID = string.Empty;
            if (y!=null && y.Length > 0)
            {

                string[] splitted = y[0].Split(',');
                foreach (string a in splitted)
                {
                   // MessageBox.Show("Parameter : " + a);
                }
                try
                {
                    processID = splitted[0].ToString();
                    StaticClass.processID = Convert.ToInt32(processID.Trim());
                }
                catch (Exception) { }
                try
                {
                    StaticClass.programType = Convert.ToInt32(splitted[1]);
                }
                catch (Exception) { }
                try
                {
                    int startType = Convert.ToInt32(splitted[2]);
                    if (startType == 1) {
                        StaticClass.TYPE_STARTUP =STARTUP_TYPES.BY_USER_ON_PROGRAM;
                    }
                    else if (startType == 0) {
                        StaticClass.TYPE_STARTUP = STARTUP_TYPES.ON_PROGRAM;
                    }                    
                }
                catch (Exception) { }
            }
            else
            {                
                StaticClass.TYPE_STARTUP = STARTUP_TYPES.EXPLICIT;
            }
        }
    }    
}
